#include <stdio.h>
#include "touch.h"
#include "lcd.h"


int main(){
    int x =0,y=0;
    int pre_x = 0,pre_y = 0;
    int lcdfd ,tsfd;
    int leaveSvreen = 0;
    initLcd(&lcdfd);
    initTs(&tsfd);
    while (1)
    {
        pre_x = x;
        pre_y = y;
        leaveSvreen = touch_wait(tsfd,&x,&y);
        if(x < 50 && y < 50&&leaveSvreen!=0){
            clearScreen(lcdfd);
        }else{
            drawACir(lcdfd,x,y,10);
            if(pre_x!=0&&pre_y!=0&&leaveSvreen==0){
            drawALine(pre_x,x,pre_y,y,lcdfd,10);
            }      
        }    

    }   
    return 0;
}